﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using EFFC.Net.Parameters;

namespace EFFC.Net.ResourceLib.Parameters
{
    /// <summary>
    /// Print參數模板
    /// </summary>
    [Serializable]
    public class PrintParameter : ParametersStd
    {
        public PrintParameter()
        {
            //字符串列印
            this.AddPElement("PrintString");

            //文件打印
            this.AddPElement("PrinterName");
            AddPElement("PrintFiles", typeof(PrintFileCollection));
            SetValue("PrintFiles", new PrintFileCollection());

            //標籤打印
            this.AddPElement("PrintLabelTemplate");
            this.AddPElement("PrintLabelRecordSize",typeof(Int32));

            AddPElement("PrintLabelField", typeof(List<string>));
            SetValue("PrintLabelField", new List<string>());

            AddPElement("PrintLabelString", typeof(List<string>));
            SetValue("PrintLabelString", new List<string>());

            //列印間隔時間
            this.AddPElement("PrintWaitTime", typeof(Int32));
            
        }

        /// <summary>
        /// 待列印的字符串
        /// </summary>
        public string PrintString
        {
            get { return GetValue<string>("PrintString"); }
            set { SetValue("PrintString", value); }
        }

        /// <summary>
        /// 指定列印機的名稱
        /// </summary>
        public string PrinterName
        {
            get { return GetValue<string>("PrinterName"); }
            set { SetValue("PrinterName", value); }
        }

        /// <summary>
        /// 待列印的文件集合
        /// </summary>
        public PrintFileCollection PrintFiles
        {
            get { return GetValue<PrintFileCollection>("PrintFiles"); }
            set { SetValue("PrintFiles", value); }
        }


        /// <summary>
        /// 標籤列印的模本文件中多個記錄組
        /// </summary>
        public int PrintLabelRecordSize
        {
            get { return GetValue<Int32>("PrintLabelRecordSize"); }
            set { SetValue("PrintLabelRecordSize", value); }
        }

        /// <summary>
        /// 模板文件上一個標籤Filed集合
        /// </summary>
        public List<string> PrintLabelField
        {
            get { return GetValue<List<string>>("PrintLabelField"); }
            set { SetValue("PrintLabelField", value); }
        }

        /// <summary>
        /// 標籤列印的模板文件路徑
        /// </summary>
        public string PrintLabelTemplate
        {
            get { return GetValue<string>("PrintLabelTemplate"); }
            set { SetValue("PrintLabelTemplate", value); }
        }

        /// <summary>
        /// 待列印的一組標籤字符串，以“|”分隔
        /// </summary>
        public List<string> PrintLabelList
        {
            get { return GetValue<List<string>>("PrintLabelString"); }
            set { SetValue("PrintLabelString", value); }
        }

        /// <summary>
        /// 列印間隔時間
        /// </summary>
        public int PrintWaitTime
        {
            get {
                int time=GetValue<Int32>("PrintWaitTime");
                if (time == 0)
                    return 1000;
                else
                    return time; 
            
            }
            set { SetValue("PrintWaitTime", value); }
        }
    }
}
